import { http } from './request.js';
import { uploadFile } from './uploadFile.js';
import { config } from '@/config/index.js';
import { utils } from '@/utils/index.js';

// 谷歌登录
const google_login = (params = {}) => {
	return http.post(`${config.INTERFACE}/api/user/google_login`, params)
};

// 退出登录
const loginOut = (params = {}) => {
	return http.post(`/LoginReq`, params)
};

// 用户信息获取
const getUserInfo = (params = {}) => {
	return http.post(`${config.INTERFACE}/api/user/get_user_info`, params)
};

// 用户信息更改
const changeUserInfo = (params = {}) => {
	return http.post(`${config.INTERFACE}/api/user/change_user_info`, params)
};

// 历史记录
const getHistory = (params = {}) => {
	return http.post(`${config.INTERFACE}/api/chat/get_message_list`, params)
}

// 上传头像
const uploadImg = (path = '') => {
	return uploadFile(`${config.INTERFACE}/api/images/upload`, {
		filePath: path,
		name: 'file'
	})
}

// 推荐问题
const getRandomQuestions = (params = {}) => {
	return http.post(`${config.DEV}/api/question/getRandomQuestions`, params)
}

export default {
	loginOut,
	google_login,
	uploadImg,
	getHistory,
	getUserInfo,
	changeUserInfo,
	getRandomQuestions,
}